package com.sj.purchase.modules.cost.repository.order;

import com.sj.purchase.modules.cost.domain.order.Order;
import com.sj.purchase.modules.cost.domain.order.OutOrder;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Date;
import java.util.List;

/**
 * Created by 宋开宗 on 2017/7/19 0019.
 */
public interface OutOrderRepository extends JpaRepository<OutOrder, String>, JpaSpecificationExecutor<OutOrder> {

    List<OutOrder> findByCreateDateBetweenOrderByCreateDate(Date start, Date end);

    List<OutOrder> findByCreateDateBetweenAndOrderNoIsNotNullAndTypeNot(Date start, Date end, Order.OrderType type);

    Page<OutOrder> findByCreateDateBetweenAndOrderNoIsNotNullAndTypeNot(Date start, Date end, Order.OrderType type, Pageable pageable);

    OutOrder findFirstByOrderNo(String orderNo);

    List<OutOrder> findByOrderNoIn(String[] orderNos);
}
